using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JGSY.CMS.LowCode.Platform.Domain.Entities;

namespace JGSY.CMS.LowCode.Platform.Domain.Interfaces
{
    /// <summary>
    /// 审计日志仓储接口
    /// 提供审计日志实体的数据访问操作，包括增删改查和条件查询功能
    /// </summary>
    public interface IAuditLogRepository
    {
        /// <summary>
        /// 获取所有审计日志
        /// </summary>
        /// <returns>审计日志实体列表</returns>
        Task<IEnumerable<AuditLog>> GetAllAsync();
        
        /// <summary>
        /// 根据ID获取审计日志
        /// </summary>
        /// <param name="id">审计日志标识符</param>
        /// <returns>审计日志实体，如果未找到则返回null</returns>
        Task<AuditLog?> GetByIdAsync(long id);
        
        /// <summary>
        /// 添加新的审计日志
        /// </summary>
        /// <param name="entity">要添加的审计日志实体</param>
        /// <returns>添加操作任务</returns>
        Task AddAsync(AuditLog entity);
        
        /// <summary>
        /// 按条件查询审计日志
        /// </summary>
        /// <param name="type">操作类型</param>
        /// <param name="userId">用户标识符</param>
        /// <param name="start">开始时间，可选</param>
        /// <param name="end">结束时间，可选</param>
        /// <param name="resource">资源名称，默认为空字符串</param>
        /// <returns>符合条件的审计日志实体列表</returns>
        Task<IEnumerable<AuditLog>> QueryAsync(string type, long userId, DateTime? start, DateTime? end, string resource = "");
    }
}
